package tests;



import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import src.InfixFullParantEx;


public class InfixFullParantExTeste {
	private InfixFullParantEx infixFullParantEx ;
	@Before
	public void setUp(){
		infixFullParantEx = new InfixFullParantEx();
		Assert.assertNotNull(infixFullParantEx);
	}

	@Test
	public void testEvaluateInfix() {
		char[] vect = {'{','(', '*','/','+','-'};

		for (int i = 0; i < vect.length; i++) {
			Assert.assertEquals(vect[i] + "", InfixFullParantEx.evaluateInfix(vect[i] +""));
		}
		char c = '0';
		for (int i = 0; i < 10; i++) {
			Assert.assertEquals(i+"" , InfixFullParantEx.evaluateInfix(c +"-"+ i));
	}
		String[] vect2 = {"(2 / 1)","{3 + 4}","(5 - 6)","{7 * 1}","(8*1)","{9+1}","(8{6)"};

		int test1 = 2;
		int test2 = 7;
		int test3 = -1;
		int test4 = 7;
		int test5 = 8;
		int test6 = 10;
		int testV [] = {test1, test2 , test3, test4, test5, test6};

		for (int i = 0; i < vect2.length-1; i++) {
			Assert.assertEquals(testV[i]+"", InfixFullParantEx.evaluateInfix(vect2[i]));
		}
		InfixFullParantEx.evaluateInfix(vect2[vect2.length-1]);
		InfixFullParantEx.evaluateInfix("8-4}");
		//String test = "{(1*2)(3+4)(5-6)(7/8)}";
}

	@Test
	public void testEvaluateInfixExeption() {
		String test = "})";
		Assert.assertEquals("", InfixFullParantEx.evaluateInfix(test));
	}
}